# stage1: build sort.c

clang -O3 -Wl,--emit-relocs sort.c


# stage2: perf 

perf record -e cycles:u -o perf.data -- ./a.out

# stage3: convert perf.data to perf.fdata (text)

perf2bolt -nl -p perf.data -o perf.fdata a.out


# stage4: bolt app

llvm-bolt a.out -o a.out.bolt.perf data=perf.fdata -reorder-blocks=ext-tsp -reorder-functions=hfsort -split-functions -split-all-cold -split-eh -dyno-stats


# stage5: test

./a.out

./a.out.bolt.perf
